package person;

public class Person implements Comparable {
	private long id;
	private String name;
	private String phone;
	
	public Person(){}
	public Person(int id, String name, String phone){
		this.id = id;
		this.name = name;
		this.phone = phone;
	}
	
	//id as comparator
	@Override
	public int compareTo(Object obj) {
		Person prs = (Person) obj;
		if(this.id < prs.id){
			return this.name.compareTo(prs.name);
		//	
		}
		else if(this.id > prs.id){
			return this.name.compareTo(prs.name);
		//	
		}
		return 0;
	}
	
	//name as comparator
//	Person prs = (Person)obj;
//	return this.name.compareTo(prs.name);
//	
	public String toString(){
		return name +"\t" + phone;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}	
	
	
}

